<?php
echo validation_errors();
$form = array(
    'id'    => 'form-news',
    'class' => 'ut-form'
);
$options = array();
foreach($cats['cats'] as $idx=>$c)
{
    $options[$idx] = $c['name'];
    $subs = count($c['subs']);
    if($subs>0)
        foreach($c['subs'] as $sid=>$s)
            $options[$sid] = $c['name'].' >> '.$s['name'];
}
echo form_open('news/insert_news',$form);
echo form_fieldset();
echo '<ul>';
echo '<li>'.form_label('Tytuł:','title').form_input(array('name'=>'title','placeholder'=>'Wpisz tytuł artykułu','class'=>'large'),set_value('title')).'</li>';
echo '<li>'.form_label('Data publikacji: ','data_publ').'<input type="date" name="data_publ" class="small ut-datepicker" value="'.set_value('data_publ').'" id="publ-datepicker" placeholder="RRRR-MM-DD"/></li>';
echo '<li>'.form_label('Opublikowany?:','published').form_checkbox('published',set_value('published','1')).'</li>';
echo '<li>'.form_label('Kategoria','kategoria').form_dropdown('kategoria',$options,set_value('kategoria')).'</li>';
echo '<li>'.form_label('Wstęp:','intro').'<textarea class="ckeditor" name="intro">'.set_value('intro').'</textarea></li>';
echo '<li>'.form_label('Treść:','content').'<textarea class="ckeditor" name="content">'.set_value('content').'</textarea></li>';
echo '</ul>';
echo form_fieldset_close();
echo form_fieldset('Elementy SEO','class="clear left large"');
echo '<ul>';
echo '<li>'.form_label('Title:','seo-title').form_input(array('name'=>'seo-title','placeholder'=>'Wpisz treść meta: title','class'=>'large'),set_value('seo-title')).'</li>';
echo '<li>'.form_label('Description:','seo-desc').'<textarea name="seo-desc" class="large">'.set_value('seo-desc').'</textarea></li>';
echo '<li>'.form_label('Keywords:','seo-keys').form_input(array('name'=>'seo-keys','placeholder'=>'Wpisz treść meta: keywords','class'=>'large'),set_value('seo-keys')).'</li>';
echo '</ul>';
echo form_fieldset_close();
echo '<p class="clear">'.form_submit('add_news','Dodaj artykuł','class="btn-primary btn-large"').'</p>';
echo form_close();
?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>